#ifndef SETTINGS_H
#define SETTINGS_H

#include "commands.h"
#include "commclass.h"

class Settings {
public:
  Settings();
  void setSerialPtr(CommClass *ptr);
  void newDataToStruct(quint8 *data, quint16 offset, quint8 length);
  void newDataToDevice(quint8 *data, quint16 offset, quint8 length);
  void saveToEEPROM();

  // ==== Radio settings SET ====
  void setRadioModel(quint8 value);
  void setRadioCATInterfaceEnabled(bool state);
  void setRadioCATBaudrate(quint32 value);
  void setRadioCATStopbits(quint8 value);
  void setRadioCATParity(quint8 value);
  void setRadioCATICOMCIV(quint8 value);
  void setRadioCATFlowControl(bool state);
  void setRadioCATJumperRTSCTS(bool state);
  void setRadioCATRetrieveType(qint8 value);
  void setRadioCATPollRate(qint16 value);

  // ==== Radio settings GET ====
  quint8 getRadioModel();
  bool getRadioCATInterfaceEnabled();
  quint32 getRadioCATBaudrate();
  quint8 getRadioCATStopbits();
  quint8 getRadioCATParity();
  quint8 getRadioCATICOMCIV();
  bool getRadioCATFlowControl();
  bool getRadioCATJumperRTSCTS();
  quint8 getRadioCATRetrieveType();
  quint16 getRadioCATPollRate();


  // ==== PTT handler SET ====
  void setPTTInputEnabled(quint8 input);
  void setPTTInputInvert(quint8 input);
  void setPTTRadioPreDelay(quint16 delay);
  void setPTTRadioPostDelay(quint16 delay);
  void setPTTAmpPreDelay(quint16 delay);
  void setPTTAmpPostDelay(quint16 delay);
  void setPTTInhibitPreDelay(quint16 delay);
  void setPTTInhibitPostDelay(quint16 delay);
  void setPTTAntennaPreDelay(quint16 delay);
  void setPTTAntennaPostDelay(quint16 delay);
  void setPTTOutputCWConf(quint8 value);
  void setPTTOutputPhoneConf(quint8 value);
  void setPTTOutputDigitalConf(quint8 value);
  void setPTTOutputAmplifierEnabled(bool value);
  void setPTTOutputInhibitEnabled(bool value);

  // ==== PTT handler GET ====
  quint8 getPTTInputEnabled();
  quint8 getPTTInputInvert();
  bool getPTTInputEnabled(quint8 bitNr);
  bool getPTTInputInvert(quint8 bitNr);
  quint16 getPTTRadioPreDelay();
  quint16 getPTTRadioPostDelay();
  quint16 getPTTAmpPreDelay();
  quint16 getPTTAmpPostDelay();
  quint16 getPTTInhibitPreDelay();
  quint16 getPTTInhibitPostDelay();
  quint16 getPTTAntennaPreDelay();
  quint16 getPTTAntennaPostDelay();
  quint8 getPTTOutputCWConf();
  quint8 getPTTOutputPhoneConf();
  quint8 getPTTOutputDigitalConf();
  bool getPTTOutputAmplifierEnabled();
  bool getPTTOutputInhibitEnabled();

  // ==== AUDIO ROUTING SET ====
  void setAudioRoutingLineInSourceCW(quint8 index, quint8 state);
  void setAudioRoutingLineInSourcePhone(quint8 index, quint8 state);
  void setAudioRoutingLineInSourceDigital(quint8 index, quint8 state);
  void setAudioRoutingMicPath(quint8 index, quint8 state);
  void setAudioRoutingComputerGeneratedPathPhone(quint8 index, quint8 state);
  void setAudioRoutingComputerGeneratedPathDigital(quint8 index, quint8 state);
  void setAudioRoutingMicMute(quint8 index, bool state);
  void setAudioRoutingMicPreamp(quint8 index, bool state);
  void setAudioRoutingMuteLineOutPhone(quint8 index, bool state);
  void setAudioRoutingMuteLineOutDigital(quint8 index, bool state);

  quint8 getAudioRoutingLineInSourceCW(quint8 index);
  quint8 getAudioRoutingLineInSourcePhone(quint8 index);
  quint8 getAudioRoutingLineInSourceDigital(quint8 index);
  quint8 getAudioRoutingMicPath(quint8 index);
  quint8 getAudioRoutingComputerGeneratedPathPhone(quint8 index);
  quint8 getAudioRoutingComputerGeneratedPathDigital(quint8 index);
  bool getAudioRoutingMicMute(quint8 index);
  bool getAudioRoutingMicPreamp(quint8 index);
  bool getAudioRoutingMuteLineOutPhone(quint8 index);
  bool getAudioRoutingMuteLineOutDigital(quint8 index);

private:
  CommClass *serialPort;
  struct_settings settings;
};

#endif // SETTINGS_H
